﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Data;
using System.Web.UI.WebControls;
using System.Configuration;

namespace CTEA_INDIA
{
    public partial class View_Artist_Info : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BAL.conn.connectionString = ConfigurationManager.ConnectionStrings["CTEA"].ConnectionString;
            populateArtistInfo();

        }

        public void populateArtistInfo()
        {

            DataSet ds = BAL.Customers.ViewAllArtists();
            gdArtistInfo.DataSource = ds;
            gdArtistInfo.DataBind();

        }

        protected void gdArtistInfo_PageIndexChanging(object sender , GridViewPageEventArgs e)
        {
            gdArtistInfo.PageIndex = e.NewPageIndex;
            populateArtistInfo();
        }


        protected void gdArtistInfo_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                LinkButton lEdit = (LinkButton)e.Row.FindControl("lnkEdit");
                Button update = (Button)e.Row.FindControl("btnUpdate");
                LinkButton lDelete = (LinkButton)e.Row.FindControl("lnkDelete");
                lDelete.CommandArgument = e.Row.RowIndex.ToString();
            }

        }


        protected void lnkView_Click(object sender, EventArgs e)
        {
            LinkButton lnkVw = sender as LinkButton;
            GridViewRow row = (GridViewRow)lnkVw.Parent.Parent;
            // int locationID = Convert.ToInt32(ddlLocation.SelectedValue);


            int Cid = Convert.ToInt32(gdArtistInfo.DataKeys[row.RowIndex]["ArtistID"]);


            string[] Details = BAL.Customers.GetArtistInfoById(Cid);

            lblArtistName.Text = Details[1];
            lblArtistAddress.Text = Details[2];
            lblContactNo.Text = Details[3];
            lblArtistCommitment.Text = Details[4];
            lblFeedback.Text = Details[5];

            lnkView_ModalPopupExtender.Show();

            
        }

    }
}